package com.winter.portal.api.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * <p>
 * 资源表
 * </p>
 *
 * @author jzyan
 * @since 2022-03-10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResourceDTO implements Serializable {

    @NotNull(message = "not null", groups = Update.class)
    @ApiModelProperty("id")
    private Long id;
    @ApiModelProperty(value = "父级资源id, 目录则填0")
    private Long parentId;
    @NotBlank(message = "not null")
    @Length(max = 15, message = "资源名15位")
    @ApiModelProperty(value = "资源名", required = true)
    private String resourceName;
    @ApiModelProperty("权限标识")
    private String permission;
    @ApiModelProperty(value = "资源图标")
    private String icon;
    @ApiModelProperty(value = "资源链接")
    private String url;
    @Min(value = 0, message = "0或1或2或3")
    @Max(value = 3, message = "0或1或2或3")
    @ApiModelProperty(value = "资源类型 (0-系统-保留值，1-目录, 2-菜单, 3-按钮)")
    private Integer type;
    @ApiModelProperty(value = "同级资源排序字段")
    private Integer sort;

    public interface Update {
    }

}
